#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int fun(int n)
{
	int sum = 0;
	while (n)
	{
		sum++;
		n /= 10;
	}
	return sum;
}
int main()
{
	int i = 0, n = 0, temp = 0, sum1 = 0, sum2 = 0, j = 0, k = 0, sum = 0;
	scanf("%d", &n);
	for (i = 1; i <= n; i++)
	{
		temp = i;
		sum1 = sum2 = j = 0;
		int arr[100] = { 0 };
		while (temp)
		{
			arr[j++] = temp % 10;
			temp /= 10;
		}
		for (k = 0; k < j; k++)
		{
			if (k % 2 == 0 && arr[k] % 2 != 0)
				sum1++;
			else if (k % 2 != 0 && arr[k] % 2 == 0)
				sum2++;
		}
		if (sum1 + sum2 == fun(i))
			sum++;
	}
	printf("%d\n", sum);
	return 0;
}